package ee.subjects.frontend.controller.command.personCommands;

import java.io.IOException;
import java.sql.Date;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ee.subjects.backend.model.data.Address;
import ee.subjects.backend.model.data.Contact;
import ee.subjects.backend.model.data.Person;
import ee.subjects.frontend.controller.ViewManager;
import ee.subjects.frontend.controller.command.Command;
import ee.subjects.frontend.controller.model.CustomAttripute;

public class InsertPersonCommand implements Command {

	@Override
	public int execute(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		request.setAttribute ("PersonId", "");
		
		Person person = new Person();
		person.setFirst_name("");
		person.setLast_name("");
		person.setIdentity_code("");
		request.setAttribute ("Person", person);
		
		
		request.setAttribute ("Command", "InsertPersonCommand");
		
		Address address = new Address();
		address.setCountry("");
		address.setCounty("");
		address.setStreet_address("");
		address.setTown_village("");
		address.setZipcode("");
		request.setAttribute ("MainAddress", address);
		
		request.setAttribute ("AdditionalAddresses", new ArrayList<Address>());
		request.setAttribute ("PersonSpecificAttributes", new ArrayList<CustomAttripute>());
		request.setAttribute ("CustomerSpecificAttributes", new ArrayList<CustomAttripute>());
		request.setAttribute ("Contacts", new ArrayList<Contact>());
		request.setAttribute ("IsCustomer", "N");
		
		return 1 ;
	}

}
